package es.udc.emarketapp.emarket.model.countryFacade.actions;

import java.sql.Connection;

import es.udc.emarketapp.emarket.model.country.dao.SQLCountryDAO;
import es.udc.emarketapp.emarket.model.country.dao.SQLCountryDAOFactory;

import es.udc.fbellas.j2ee.util.exceptions.InstanceNotFoundException;
import es.udc.fbellas.j2ee.util.exceptions.InternalErrorException;
import es.udc.fbellas.j2ee.util.sql.NonTransactionalPlainAction;


public class FindIdByNameAction implements NonTransactionalPlainAction {

	    private String nomPais;
	    
	    public FindIdByNameAction(String nomPais) {
	    	this.nomPais = nomPais;
	    }

	    /**
	     *
	     * @return the <code>ProductVO</code>
	     */
	    public Object execute(Connection connection) 
	        throws InstanceNotFoundException, InternalErrorException {
	                
	        SQLCountryDAO countryDAO = SQLCountryDAOFactory.getDAO();
	            
	        return countryDAO.findIdByName(connection, nomPais);

	    }

	    
	}